using System;
using System.Text.RegularExpressions;
namespace AppToolKit.Model.Validation
{
	public class ValidationUtil
	{
		public static bool IsDateTime(string timeString)
		{
			int num = 0;
			bool result;
			try
			{
				num = int.Parse(timeString.Substring(0, 4));
			}
			catch
			{
				result = false;
				return result;
			}
			string pattern;
			if ((num % 4 == 0 && num % 100 != 0) || num % 400 == 0)
			{
				pattern = "^((((1[6-9]|[2-9]\\d)\\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\\d|3[01]))|(((1[6-9]|[2-9]\\d)\\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\\d|30))|(((1[6-9]|[2-9]\\d)\\d{2})-0?2-(0?[1-9]|1\\d|2[0-9])))(\\s([0-1]\\d|2[0-3]):([0-5]\\d))?$";
				goto IL_56;
			}
			pattern = "^((((1[6-9]|[2-9]\\d)\\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\\d|3[01]))|(((1[6-9]|[2-9]\\d)\\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\\d|30))|(((1[6-9]|[2-9]\\d)\\d{2})-0?2-(0?[1-9]|1\\d|2[0-8])))(\\s([0-1]\\d|2[0-3]):([0-5]\\d))?$";
			IL_56:
			Regex regex = new Regex(pattern, RegexOptions.Compiled);
			Match match = regex.Match(timeString);
			result = match.Success;
			return result;
		}
		public static bool IsInt32(string num)
		{
			string pattern = "^\\d+$";
			Regex regex = new Regex(pattern, RegexOptions.Compiled);
			Match match = regex.Match(num);
			return match.Success;
		}
		public static bool IsDecimal(string num)
		{
			string pattern = "^(\\d)+(.\\d+)?$";
			Regex regex = new Regex(pattern, RegexOptions.Compiled);
			Match match = regex.Match(num);
			return match.Success;
		}
		public static bool IsEmpty(string str)
		{
			return str != null && str.Trim() != string.Empty;
		}
	}
}
